import fetch from '../utils/fetch'



export function getInfo(token) {
  return fetch({
    url: '/user/get/info',
    method: 'get',
    params: { token }
  })
}

export function logout(token) {
  return fetch({
    url: '/user/logout',
    method: 'get',
   params: { token }
  })
}

export function updateUserInfo(user) {
  return fetch({
    url: '/user/update/info',
    method: 'post',
   data: {
     user
   }
  })
}

export function uploadImg(src) {
  return fetch({
    url: '/upload/img',
    method: 'post',
   data: {
     src
   }
  })
}


export function addDiscoussion(content,imgs,user) {
  return fetch({
    url: '/add/discussion',
    method: 'post',
   data: {
     content,
     imgs,
     user
   }
  })
}

export function getUserComment(token) {
  return fetch({
    url: '/get/user/comment',
    method: 'get',
   params: {
     token
   }
  })
}


export function getDiscussion(token) {
  return fetch({
    url: '/get/discussion',
    method: 'get',
    params:{
        token
    }
  })
}

export function getUserWork(token) {
  return fetch({
    url: '/get/work',
    method: 'get',
    params:{
        token
    }
  })
}



export function login(username,ps) {
  return fetch({
    url: '/user/login',
    method: 'post',
    data:{
       username,ps
    }
  })
}





